Skip to content

Use live quotes in Firstrade price history#48

Merged
Pigbibi merged 1 commit into
mainfrom
fix/firstrade-live-quote-overlay
May 27, 2026
Merged

Use live quotes in Firstrade price history#48
Pigbibi merged 1 commit into
mainfrom
fix/firstrade-live-quote-overlay

Conversation

@Pigbibi

@Pigbibi Pigbibi commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • overlay Firstrade OHLC history with the latest quote for the current market date
  • keep historical data as fallback when quote retrieval fails
  • add adapter tests for append, replace, and fallback behavior

Tests

  • .venv/bin/python -m pytest tests/test_runtime_broker_adapters.py -q
  • .venv/bin/python -m pytest tests/test_execution_service.py -q
  • .venv/bin/python -m pytest -q
  • .venv/bin/python -m py_compile application/runtime_broker_adapters.py tests/test_runtime_broker_adapters.py

Note: local .venv does not include ruff, so ruff was not run locally.

@Pigbibi Pigbibi merged commit 130623b into main May 27, 2026
1 check passed
@Pigbibi Pigbibi deleted the fix/firstrade-live-quote-overlay branch May 27, 2026 20:27

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc3be349c6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +118 to +122
quote_point = PricePoint(as_of=quote.as_of, close=quote.last_price)
last_market_date = _market_date(points[-1].as_of)
quote_market_date = _market_date(quote_point.as_of)
if quote_market_date > last_market_date:
points.append(quote_point)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid dating stale quotes as new daily bars

When get_price_series() runs on a weekend/holiday or after midnight ET before a new OHLC candle exists, load_quote() stamps the quote with self.clock() rather than the trade timestamp, so this appends an artificial market-history point for a non-trading day. The client already exposes quote_time/last_trade_time in get_quote() (application/firstrade_client.py), but they are ignored here; strategies consuming market_history/derived indicators will see an extra daily bar even though the last trade was on the previous market session.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant